export default {
    // 开启命名空间
    namespaced: true,
    state: {
        name: "我是张三123"
    },
    getters: {
        newName(state) {
            return state.name + '!!!'
        }
    },
    mutations: {
        CHANGE_NAME(state) {
            state.name = "我是被修改过以后的张三"
        },
        CAHNGE_ASYNC_NAME(state, { text }) {
            state.name = text
        }
    },
    // 只发起异步
    actions: {
        init({ commit }) {
            setTimeout(() => {
                commit("CAHNGE_ASYNC_NAME", {
                    text: "异步结果"
                })
            }, 1000)
        }
    }
}